<template>
 <view>
   <u-empty v-if="msgList.length===0"
           mode="message"
           icon="http://cdn.uviewui.com/uview/empty/car.png"
   >
   </u-empty>
   
   <!-- 消息列表 -->
   <view class="card" v-for="(item ,index) in msgList" :key="index" @click.native="messageDetail(item.id)">
     <view>
       <text class='card-title'>用户请求支援</text>  
       <text class='card-date' style="float: right;">{{item.time}}</text>
     </view>  
       <text class='card-desc'>{{item.description}}</text>
       <text class='card-read arrow'>查看详情</text>
       <u-badge v-show='show2' :isDot="item.state===0" type="error"></u-badge>
   </view>
       <view class="not-more" v-show="show3" style="margin-bottom: 0%;">已经到底了~~</view>
 </view>
</template>

<script>
  export default {
    beforeDestroy() {
      uni.navigateTo({
        url:'/pages/emergencyAdministrator/emergencyAdministrator'
      })
    },
    onLoad(option) {
      const item = JSON.parse(decodeURIComponent(option.item));
      console.log(item)
      this.msgList=item
    },
    data() {
      return {
        msgList:[],
      };
    },
    methods:{
      async messageDetail(id){
        // console.log(id)
        // 消息被阅读，需要改状态
        // this.updateMessage(id)
        // 设置消息提醒的数量-1
        // this.setMsgTip()
        uni.navigateTo({
          url:'/pages/msgDetail/msgDetail?id='+id,
        })      
      },
    }
  }
</script>

<style lang="scss" scoped>
 .card{
      background-color: #fff;
      border:1rpx solid #ddd;
      border-radius: 10rpx;
      margin: 60rpx 20rpx;
      padding: 20rpx 30rpx;
      display: flex;
      flex-direction: column;
  }
  .card-title{
      font-size: 40rpx;
      margin-bottom: 40rpx;
  }
  .card-date{
      font-size: 28rpx;
      color:#ccc;
      padding-bottom: 20rpx;
      // border-bottom: 1rpx solid #ddd;
      margin-bottom: 20rpx;
  }
  .card-img{
      width: 100%;
      height: 300rpx;
  }
  .card-desc{
      font-size:32rpx;
      color:#333;
      padding-bottom: 20rpx;
      border-bottom: 1rpx solid #ddd;
      margin: 20rpx 0 ; 
  }
  .card-read{
      font-size:28rpx;
      color:#666;
  }
</style>
